package com.healthcare.client.controller;


import com.healthcare.client.pojo.Message;
import com.healthcare.client.service.MessageService;
import com.healthcare.client.vo.MessageVo;
import com.healthcare.common.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 聊天记录 前端控制器
 * </p>
 *
 * @author 新华医院转诊联盟
 * @since 2020-04-13
 */
@Api(tags = "前台Im消息")
@RestController
@RequestMapping("/client/message")
public class MessageController {

    @Autowired
    private MessageService messageService;


    @ApiOperation("前台im显示消息方法")
    @GetMapping("imMessage/{type}/{userId}/{caseId}")
    public Result getImList(
            @ApiParam(name = "type",value = "辨识转诊会诊 ",required = true)
            @PathVariable Integer type,
            @ApiParam(name = "userId",value = "医生ID ",required = true)
            @PathVariable Integer userId,
            @ApiParam(name = "caseId",value = "转诊或者会诊ID ",required = true)
            @PathVariable Integer caseId){
        List<MessageVo>list = messageService.messageLsit(caseId,type,userId);
//        List<Message>list = messageService.messageLsit(caseId,type,userId);
        return Result.ok().data("list",list);
    }

}

